Skip to content

SnowparkOperator: Add Session Cleanup Test Coverage#68775

Merged
shahar1 merged 1 commit into
apache:mainfrom
SameerMesiah97:SnowparkOperator-Add-Session-Cleanup-Test
Jul 1, 2026
Merged

SnowparkOperator: Add Session Cleanup Test Coverage#68775
shahar1 merged 1 commit into
apache:mainfrom
SameerMesiah97:SnowparkOperator-Add-Session-Cleanup-Test

Conversation

@SameerMesiah97

Copy link
Copy Markdown
Contributor

Description

This change adds test coverage verifying that SnowparkOperator closes the Snowpark session when the user callable raises an exception.

The new test exercises the operator's exception path and validates that session cleanup still occurs when execution fails.

Rationale

SnowparkOperator relies on a finally block to guarantee session cleanup. Explicit coverage of this behavior helps protect against regressions that could leave Snowpark sessions open when user code raises an exception.

Notes

While adding the new test, the Snowpark test suite was updated to use dag_maker.run_ti() instead of the removed TaskInstance.run() API.

The Snowpark operator, decorator and util test modules were also updated to use:

pytest.importorskip("snowflake.snowpark")

which matches the importable Snowpark module used by the tests. Without this change, the entire test module was being skipped when run locally.

Backwards Compatibility

This change only affects test code and does not modify production behavior or public APIs.

@boring-cyborg boring-cyborg Bot added area:providers provider:snowflake Issues related to Snowflake provider labels Jun 19, 2026
@SameerMesiah97 SameerMesiah97 force-pushed the SnowparkOperator-Add-Session-Cleanup-Test branch from 9424e61 to bd8b317 Compare June 22, 2026 17:18
@SameerMesiah97 SameerMesiah97 marked this pull request as ready for review June 22, 2026 19:00
@SameerMesiah97 SameerMesiah97 requested a review from potiuk as a code owner June 22, 2026 19:00
@SameerMesiah97 SameerMesiah97 marked this pull request as draft June 22, 2026 20:28
@SameerMesiah97 SameerMesiah97 marked this pull request as ready for review June 22, 2026 20:28
session when the user callable raises an exception.

As part of enabling the new coverage, migrate the Snowpark tests
away from the removed TaskInstance.run() API and update Snowpark
test dependency detection to use the importable Snowpark module.
@SameerMesiah97 SameerMesiah97 force-pushed the SnowparkOperator-Add-Session-Cleanup-Test branch from bd8b317 to 3780768 Compare June 22, 2026 21:34
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jun 25, 2026
@SameerMesiah97

Copy link
Copy Markdown
Contributor Author

Requesting review for this.

@shahar1 shahar1 merged commit ec5f19d into apache:main Jul 1, 2026
80 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:snowflake Issues related to Snowflake provider ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants